#!/bin/bash
set -e

find /etc/nginx -name 'default.conf' | xargs sed -i "s V_SERVER_NAME $SERVER_NAME g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://fpwddev.quanyou.com.cn $PSW_URL g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s wss://ccdev.quanyou.com.cn:9011 $NOTICE_WS g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://ccdev.quanyou.com.cn $VUE_APP_BASE_API g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://ccdev.quanyou.com.cn/img/ $VUE_APP_BASE_QUP g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://ccdev.quanyou.com.cn $VUE_APP_LOGIN_BASE_API g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://ccdev.quanyou.com.cn/api/xing-callproxy $VUE_APP_CALL_PROXY_URL g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://ccdev.quanyou.com.cn/api/xing-callproxy2 $VUE_APP_CALL_PROXY_URL2 g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s PC6000711 $RESP_MENUCODE g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s PC1723701 $OFFICE_MENUCODE g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s PC3336005 $DISTRICENTER_MENUCODE g"
find /usr/share/nginx/html -name '*.js' | xargs sed -i "s https://filedev.quanyou.com.cn $FILE_PREFIX g"


cat /etc/nginx/conf.d/default.conf

exec "$@"
